1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module pango.PgScript; 26 27 private import gobject.ObjectG; 28 private import pango.PgLanguage; 29 private import pango.c.functions; 30 public import pango.c.types; 31 32 33 /** */ 34 public struct PgScript 35 { 36 37 /** 38 * Looks up the script for a particular character. 39 * 40 * The script of a character is defined by 41 * [Unicode Standard Annex 24: Script names](http://www.unicode.org/reports/tr24/). 42 * 43 * No check is made for @ch being a valid Unicode character; if you pass 44 * in invalid character, the result is undefined. 45 * 46 * Note that while the return type of this function is declared 47 * as `PangoScript`, as of Pango 1.18, this function simply returns 48 * the return value of [func@GLib.unichar_get_script]. Callers must be 49 * prepared to handle unknown values. 50 * 51 * Deprecated: Use g_unichar_get_script() 52 * 53 * Params: 54 * ch = a Unicode character 55 * 56 * Returns: the `PangoScript` for the character. 57 * 58 * Since: 1.4 59 */ 60 public static PangoScript scriptForUnichar(dchar ch) 61 { 62 return pango_script_for_unichar(ch); 63 } 64 65 /** 66 * Finds a language tag that is reasonably representative of @script. 67 * 68 * The language will usually be the most widely spoken or used language 69 * written in that script: for instance, the sample language for 70 * %PANGO_SCRIPT_CYRILLIC is ru (Russian), the sample language for 71 * %PANGO_SCRIPT_ARABIC is ar. 72 * 73 * For some scripts, no sample language will be returned because 74 * there is no language that is sufficiently representative. The 75 * best example of this is %PANGO_SCRIPT_HAN, where various different 76 * variants of written Chinese, Japanese, and Korean all use 77 * significantly different sets of Han characters and forms 78 * of shared characters. No sample language can be provided 79 * for many historical scripts as well. 80 * 81 * As of 1.18, this function checks the environment variables 82 * `PANGO_LANGUAGE` and `LANGUAGE` (checked in that order) first. 83 * If one of them is set, it is parsed as a list of language tags 84 * separated by colons or other separators. This function 85 * will return the first language in the parsed list that Pango 86 * believes may use @script for writing. This last predicate 87 * is tested using [method@Pango.Language.includes_script]. This can 88 * be used to control Pango's font selection for non-primary 89 * languages. For example, a `PANGO_LANGUAGE` enviroment variable 90 * set to "en:fa" makes Pango choose fonts suitable for Persian (fa) 91 * instead of Arabic (ar) when a segment of Arabic text is found 92 * in an otherwise non-Arabic text. The same trick can be used to 93 * choose a default language for %PANGO_SCRIPT_HAN when setting 94 * context language is not feasible. 95 * 96 * Params: 97 * script = a `PangoScript` 98 * 99 * Returns: a `PangoLanguage` that is representative 100 * of the script 101 * 102 * Since: 1.4 103 */ 104 public static PgLanguage scriptGetSampleLanguage(PangoScript script) 105 { 106 auto __p = pango_script_get_sample_language(script); 107 108 if(__p is null) 109 { 110 return null; 111 } 112 113 return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) __p, true); 114 } 115 }